package mysql

import (
	"gorm.io/gorm"
)

type Collection struct {
	gorm.Model
	UserId  int `gorm:"type:int;not null;comment:'用户id'"`
	VideoId int `gorm:"type:int;not null;comment:'视频id'"`
	Status  int `gorm:"type:tinyint;not null;comment:'收藏状态'"`
}

func (c *Collection) CollectAdd(db *gorm.DB) error {
	return db.Debug().Create(c).Error
}

func (c *Collection) CollectDel(db *gorm.DB, userId int64, videoId int64) error {
	return db.Debug().Where("user_id = ?", userId).Where("video_id = ?", videoId).Delete(c).Error
}
